from flask import Blueprint, render_template, request

offsetBp = Blueprint('offsetBp', __name__, url_prefix="/offset")


@offsetBp.route("/flush", methods=['GET', 'POST'])
def flush():
    offset = request.form.get('offset', type=str).strip(" ").replace(" ", "")
    with open("conf/offset.txt", "w") as f:
        f.write(offset)  # 自带文件关闭功能，不需要再写f.close()
    return render_template("success.html", offset=offset)
